package com.my12306.common.util.quartz.job;

import com.google.gson.Gson;
import com.my12306.common.util.RedisUtils;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author:苏牧夕
 * @Date:2020/5/28 0:17
 * @Version 1.0
 */
@Component("redisJob")
// TODO: 2020/5/29
public class RedisJob extends BaseJob {
    @Autowired
    private RedisUtils redisUtils;

    @Override
    protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
        Gson gson = new Gson();
        Object data = context.getJobDetail().getJobDataMap().get("data");
        Object job = context.getJobDetail().getJobDataMap().get("job");
        System.out.println("缓存key前缀：" + data.toString());
        redisUtils.deleteKeys(data.toString());
    }
}
